package com.qing.springbootinit.controller;

import com.qing.springbootinit.common.BaseResponse;
import com.qing.springbootinit.common.ResultUtils;
import com.qing.springbootinit.service.ChatmessagesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

// * @author <a href="https://github.com/qingfengzy">qingfengzy</a>

@RestController
@RequestMapping("/chatMsg")
@Slf4j
public class ChatMessageController {

    @Resource
    private ChatmessagesService chatmessagesService;

    @PostMapping("/send/{roomId}")
    public BaseResponse<String> doChat(HttpServletRequest request, @PathVariable("roomId") String roomId , String userPrompt ){
//        String message = chatmessagesService.doChatOFIM(request, roomId, userPrompt);
        log.info("请求路径: {}", request.getRequestURI());
        log.info("roomId: {}", roomId);
        String message = chatmessagesService.doChatOfDB(request, roomId, userPrompt);
        return ResultUtils.success(message);
    }
}
